Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top | Next |

Managing Double Buffers

If you wish to customize the double buffering algorithm that the Sound Manager uses to manage a play from disk, you can use the SndPlayDoubleBuffer function. The Sound Manager's high-level play-from-disk routines make extensive use of this function.

SndPlayDoubleBuffer

The SndPlayDoubleBuffer function is a low-level routine that gives you maximum efficiency and control over double buffering while still maintaining compatibility with the Sound Manager.

FUNCTION SndPlayDoubleBuffer (chan: SndChannelPtr;
                                         theParams: SndDoubleBufferHeaderPtr): OSErr;
chan
A pointer to a valid sound channel.
theParams
A pointer to a sound double buffer header record.

DESCRIPTION

The SndPlayDoubleBuffer function launches a low-level sound play using the information in the double buffer header record specified by theParams . After your application calls this function, the Sound Manager repeatedly calls the doubleback procedure you specify in the double buffer header record. The doubleback procedure then manages the filling of buffers of sound data from disk whenever one of the two buffers specified in the double buffer header record becomes exhausted.

SPECIAL CONSIDERATIONS

Because the SndPlayDoubleBuffer function might move memory, you should not call it at interrupt time.

You can use the SndPlayDoubleBuffer function only on a Macintosh computer that supports the play-from-disk routines. For information on how to determine whether a computer supports these routines, see "Testing for Multichannel Sound and Play-From-Disk Capabilities" .

ASSEMBLY-LANGUAGE INFORMATION

The trap macro and routine selector for the SndPlayDoubleBuffer function are

Trap macro

Selector

_SoundDispatch

$00200008

RESULT CODES

noErr

0

No error

badChannel

-205

Channel is corrupt or unusable

SEE ALSO

For information on the format of a doubleback procedure, see "Doubleback Procedures" .


© 1999 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top | Next |